#include "Transform.h"

Transform::Transform(void):m_Changed(true)
{

}

Transform::~Transform(void)
{
}

void Transform::Reset()
{
	m_CompiledMatrix.SetAsIdentity();
	this->ResetTransformParameters();
}

void Transform::TransformVector(DAEFloat3& vOut, DAEFloat3 &vToTransform) const 
{
	if ( IsChanged() ) {
		RecalculateMatrix();
		m_Changed = false;
	}
	m_CompiledMatrix.TransformVector(vOut,vToTransform);
}

void Transform::TransformVector(DAEFloat4& vOut, DAEFloat3& vToTransform) const
{
	if ( IsChanged() ) {
		RecalculateMatrix();
		m_Changed = false;
	}
	m_CompiledMatrix.TransformVector(vOut,vToTransform);
}

void Transform::TransformNormal(DAEFloat3& vOut, DAEFloat3 &vToTransform) const
{
	if ( IsChanged() ) {
		RecalculateMatrix();
		m_Changed = false;
	}
	m_CompiledMatrix.TransformNormal(vOut,vToTransform);
}

const DAEMatrix& Transform::GetCompiledMatrix() const{
	if (IsChanged()){
		RecalculateMatrix();
		SetChanged(false);
	}
	return m_CompiledMatrix;
}